package xin.yangshuai.jApiDocs.controller;

import io.github.yedaxia.apidocs.Docs;
import io.github.yedaxia.apidocs.DocsConfig;
import org.springframework.web.bind.annotation.*;
import xin.yangshuai.jApiDocs.model.User;

import java.util.ArrayList;
import java.util.List;

/**
 * JApiDocsController
 *
 * @author shuai
 * @date 2020/6/17
 */
@RestController
@RequestMapping("api")
public class JApiDocsController {

    /**
     * 获取用户列表
     *
     * @return
     */
    @GetMapping("users")
    public List<User> query() {
        List<User> list = new ArrayList();
        return list;
    }

    /**
     * 获取一个用户
     *
     * @param id
     * @return
     */
    @GetMapping("users/{id}")
    public User find(@PathVariable Integer id) {
        User user = new User();
        return user;
    }

    /**
     * 添加一个用户
     *
     * @param user
     * @return
     */
    @PostMapping("users")
    public int add(@RequestBody User user) {
        return 0;
    }

    /**
     * 删除一个用户
     *
     * @param id
     * @return
     */
    @DeleteMapping("users/{id}")
    public int delete(@PathVariable Integer id) {
        return 0;
    }

    /**
     * 修改一个用户
     *
     * @param user
     * @return
     */
    @PutMapping("users")
    public int update(@RequestBody User user) {
        return 0;
    }
}
